<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <title>服务评价</title>
    <meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <!--base css-->
    <link href="../css/mui/mui.css" rel="stylesheet">
    <link href="../css/app/default.css" rel="stylesheet">
    <!--自定义css-->
    <link href="../css/app/app.css" rel="stylesheet">
</head>

<body>
    <div class="mui-content">
        <div class="service-evaluate-wrap">
            <div class="service-evaluate-box">
                <div class="service-evaluate-head">
                    <span><img src="../img/common/evaluate-icon.png"></span>服务评价
                </div>
                <div class="service-evaluate-content">
                    <div class="title">感谢您对杨凌农业大数据平台的支持!</div>
                    <div class="gray-3">为帮助我们更好的为您和其他用户提供专业的咨询服务，希望您能认真完成以下评价内容：</div>
                </div>
            </div>
            <div class="service-evaluate-box">
                <div class="service-evaluate-content">
                    <div class="service-evaluate">若是1颗星代表不满意，5颗星代表非常满意，您给本次服务打几颗星？</div>
                    <div class="text-center assess-score-wrap">请打分</div>
                    <div class="assess-score text-center">

                    </div>
                    <div class="evaluate-label">

                    </div>
                </div>
            </div>
            <div class="service-evaluate-box">
                <div class="service-evaluate-content">
                    <div class="service-evaluate gray-3">对于我们的服务，如果可以的话，希望能留下您的宝贵意见或者建议</div>
                    <div class="form-group">
                        <textarea class="form-control" rows="5" placeholder="请输入意见或者建议" id="content"></textarea>
                    </div>
                </div>
            </div>
        </div>
        <div class="footer" onclick="saveConsultServiceAssess()">
            <button class="btn btn-primary btn-mid pull-right submit-btn" type="button"> 提交</button>
        </div>
    </div>
    <script src="../js/dsbridge.js"></script>
    <script src="../js/jquery.js"></script>
    <script src="../js/mui/mui.js"></script>
    <script src="../js/app/raty/jquery.raty.js"></script>
    <script src="../js/layer.js"></script>

    <script src="../js/app/app-base.js"></script>
    <script src="../js/app/app-url.js"></script>
    <script src="../js/app/app-ajax.js"></script>
    <script>
        var scoreValue = '';
        var consultSessionId = dsBridge.call("getId","");

        function saveConsultServiceAssess() {
            if (isEmpty(scoreValue)) {
                showToast('请打分');
                return;
            }
            var content = $('#content').val();
            var optArray = [];
            $('.select-opt').each(function () {
                optArray.push($(this).attr('opt'));
            });
            var opts = optArray.join(',');
            var requestData = {
                consultSessionId: consultSessionId,
                score: scoreValue,
                opts: opts,
                content: content
            };

            getServerData(url_saveConsultServiceAssess,requestData);
        }

        function getServerDataSuccess(url,data){
            dsBridge.call("saveClose","");
        }

        //评分
        $(function () {
            $('.assess-score').raty({
                starOff: '../img/common/star-off.png',
                starOn: '../img/common/star-on.png',
                hints: ['1', '2', '3', '4', '5'],
                click: function (score, evt) {
                    var htmls = '';
                    scoreValue = score;
                    if (score == 1) {
                        htmls =
                            '<span opt="31">好久不回复</span><span opt="32">解答不详细</span><span opt="33">解答不准确</span>'
                    }
                    if (score == 2 || score == 3) {

                        htmls = '<span opt="21">希望回复更快</span><span opt="22">希望回复更细致</span>'
                    }
                    if (score == 4 || score == 5) {
                        htmls =
                            '<span opt="11">回复及时</span><span opt="12">专业度强</span><span opt="13">服务态度好</span>'
                    }
                    $(".evaluate-label").html('');
                    $(".evaluate-label").append(htmls);
                }
            });
        });

        $(document).on('click', '.evaluate-label span', function () { //data参数可以省略
            if ($(this).hasClass("active")) {
                $(this).removeClass("active select-opt");
            } else {
                $(this).addClass("active select-opt");
            }
        })

    </script>
</body>

</html>